<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      header {
        width: 375px;
        height: 70px;
        background-color: chocolate;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #fff;
      }
    </style>
  </head>
  <body>
    <!-- 组件的调用可以理解成函数的调用 -->
    <!-- 同一个组件在复用的时候，里面显示的东西不一样的时候，就是由父组件传入的 -->
    <div id="app">
      <my-header title="猫眼电影">
        <span>🍉</span>
      </my-header>
      <hr />
      <my-header title="拯救嫌疑人"></my-header>
    </div>

    <script src="./vue.js"></script>
    <script>
      const MyHeader = {
        props: ["title"],
        template: `
          <header>{{ title }} <slot></slot></header>
        `,
      };

      Vue.createApp({
        data() {
          return {};
        },
        components: {
          MyHeader,
        },
      }).mount("#app");
    </script>
  </body>
</html>
